{% extends 'layout.html' %}

{#title#}
{% block title %}
    <title>用户主页</title>
{% endblock %}


{#content#}
{% block content %}
    <div class="panel panel-default">
        <!-- Default panel contents -->
        <div class="panel-heading">用户列表</div>
        <!-- Table -->
        <table class="table table-hover table-bordered">
            <tr>
                <th>序号</th>
                <th>用户名</th>
                <th>密码</th>
                <th>年龄</th>
                <th>性别</th>
                <th>操作</th>
            </tr>
            {#forloop 在for循环中可直接使用 counter  1开始计数  counter0  0开始计数  #}
            {% for user in user_list %}
                <tr>
                    <td>{{ forloop.counter }}</td>
                    <td>{{ user.username }}</td>
                    <td>{{ user.password }}</td>
                    <td>{{ user.age }}</td>
                    <td>{{ user.sex }}</td>
                    <td>
                        <button class=" btn btn-primary btn-sm">编辑</button>
                        <button class=" btn btn-danger btn-sm">删除</button>
                    </td>
                </tr>
            {% endfor %}

        </table>
    </div>
{% endblock %}